package com.woniuxy.mapper;

import com.sun.tracing.dtrace.ProviderAttributes;
import com.woniuxy.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Set;

/**
 * @author Giles
 */
public interface UserMapper {
    /**
     * 通过telephoneAndPasword查询用户对象
     * @param telephone
     * @param password
     * @return
     */
    public User selectUserByTelephoneAndPwd(@Param("telephone") String telephone,@Param("password") String password);

    /**
     * 分页查询
     * @param condition
     * @return
     */
    public List<User> selectUsersByUser(User condition);

    /**
     * 增加用户
     * @param user
     */
    public void insertUser(User user);
    /**
     * 通过手机号来查询信息
     */
    public User selectUserByTelephone(@Param("telephone") String telephone);

    /**
     * 通过用户id删除用户对象
     * @param id
     */
    public void deleteUserById(@Param("id") Integer id);

    /**
     * 通过用户的id删除用户角色中间表的记录
     * @param uid
     */
    public void deleteUserRoleByUid(@Param("uid") int uid);

    /**
     * 按id查询用户信息
     * @param id
     * @return
     */
    public User selectUserById(@Param("id") Integer id);

    /**
     * 给sys_user_role表增加信息
     */
    public void insertUserRole(@Param("uid") Integer uid,@Param("rid") Integer rid);

    public Set<String> selectRolesNamesByTelephone(@Param("telephone") String telephone);
    public Set<String> selectPerCodesByTelephone(@Param("telephone") String telephone);
}


















